function iframePool() {
  const pool = [];

  return function () {
    const iframe = document.createElement("iframe");
    pool.push(iframe);

    return {
      getIframe() {
        const ele = pool.pop();
        return ele;
      },
      recover(ele) {
        pool.push(ele);
      }
    };
  };
}

const container = iframePool()();
const iframe = container.getIframe();
document.body.appendChild(iframe);
container.recover(iframe);
window.a = 1234;

const proxyWindow = iframe.contentWindow;
const externalScripts = `
    window.abc = 1;
    console.log(window.abc);
`;

function excute() {
  const doc = proxyWindow.document;
  const sc = doc.createElement("script");
  sc.innerHTML = externalScripts;
  doc.body.appendChild(sc);
  console.log(proxyWindow.abc, "******");
}
